<template>
  <div>
    <button @click="warehouseADD">aa</button>
  </div>
</template>
  
<script lang="ts" setup>
import { computed, ref, reactive, onMounted, watch } from 'vue'
import api from '/@/api/sy/apiWMS.js';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router'

function warehouseADD() {
  var param = {
    minX: 1,
    maxX: 1,
    minY: 1,
    maxY: 20,
    minZ: 1,
    maxZ: 1,
    x: 2,
    y: 2,
    z: 2,
    type: 'list',
    codeName: '一号库'
  }
  console.log(param);

  api.post('public/Warehouse/warehouseADD', param).then((response: any) => {
    // 处理服务器返回的响应
    if (response.data.code == 200) {
      alert('新增成功')
    }
  })
    .catch((error: any) => {
      //console.log(error);
      // 处理错误
    })
    .finally(() => {
      console.log('必须执行')
    })
}
onMounted(() => {

  // 在这里写逻辑
});

</script>
  